package com.mengfx.controller;

import java.io.IOException;

import org.json.simple.parser.ParseException;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.mengfx.form.PushForm;
import com.mengfx.utils.NoticeThread;
import com.mengfx.utils.ResponseObject;

@Controller
@RequestMapping("/notice")
public class NoticeController {
	protected String NOTICE = "notice/notice";
	@RequestMapping("/tonotice")
	public String toNotice(){
		return NOTICE;
	}
	
	@ResponseBody
	@RequestMapping("/push")
	public ResponseObject<Boolean> noticePush(@ModelAttribute PushForm form) throws IOException, ParseException, Exception{
		
		NoticeThread nt = new NoticeThread(form);
		Thread first = new Thread(nt);
		first.start();
		return new ResponseObject<Boolean>(true);
	}
}
